#ifndef ELINPUT_H
#define ELINPUT_H

#include <QLineEdit>
#include "elcomponent.h"

class QEnterEvent;

class ElInput : public ElComponent
{
    Q_OBJECT
public:
    using EchoMode = QLineEdit::EchoMode;

    ElInput(QWidget *parent = nullptr);
    ElInput(const QString &text, QWidget *parent = nullptr);

    EchoMode echoMode() const;
    void setEchoMode(EchoMode echoMode);

protected:
    bool eventFilter(QObject *watched, QEvent *e) override;
    void paintEvent(QPaintEvent *e) override;
    void enterEvent(QEvent *e) override;
    void leaveEvent(QEvent *e) override;
    void initPalette() override;

private:
    static const int Fixed_Width;
    static const int Fixed_Height;
    static const int Padding_Lr;
    static const int Padding_Tb;

    QLineEdit *_lineEdit;
    QString _text;
};

#endif // ELINPUT_H
